/*
 * sockettcp.h
 *
 *  Created on: 22/05/2011
 *      Author: wadi
 */

#ifndef SOCKETTCP_H_
#define SOCKETTCP_H_
#include <log4cxx/logger.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <string.h>
#include "socket.h"

class SocketTcp: public Socket
{
public:
  SocketTcp();
  SocketTcp(struct sockaddr_in adres,int id);
  virtual
  ~SocketTcp();
  void listenTo(int cantidadConexiones);
  bool bindTo(int puerto);
  SocketTcp* acceptSocket();
  virtual bool open();

  virtual int recibir(unsigned char * buffer,int tamanioBuffer);
  virtual int escribir(char * buffer,int cantidad);
  bool connectTo(std::string url, int port);
  private:
  log4cxx::LoggerPtr logger_;
};

#endif /* SOCKETTCP_H_ */
